package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatEnclosure;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LF
 * @since 2020-08-25
 */
@Controller
@RequestMapping("/WeChatUser/wechatEnclosure")
public class WechatEnclosureController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "wechatEnclosure/WechatEnclosureMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatEnclosureHtml")
    public String addWechatEnclosureHtml( ){
             return "wechatEnclosure/WechatEnclosureAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatEnclosureHtml")
    public String editWechatEnclosureHtml(Integer id ,Model model ){
           model.addAttribute("wechatEnclosure",wechatEnclosureService.selectWechatEnclosureByIdWechatEnclosure(id));
             return "wechatEnclosure/WechatEnclosureEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatEnclosureHtml")
    public String showWechatEnclosureHtml(Integer id ,Model model ){
           model.addAttribute("wechatEnclosure",wechatEnclosureService.selectWechatEnclosureByIdWechatEnclosure(id));
             return "wechatEnclosure/WechatEnclosureShow";
    }


    /** 分页查询WechatEnclosure
     * @param page  页码
     * @param limit  查几条
     * @param wechatEnclosure  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatEnclosureByPage")
    @ResponseBody
    public ResultPage findWechatEnclosureByPage(Integer page, Integer limit,WechatEnclosure wechatEnclosure){
             return wechatEnclosureService.findWechatEnclosureByPage(page,limit,wechatEnclosure);
    }

    /** 添加WechatEnclosure
     * @param wechatEnclosure  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatEnclosure")
    @ResponseBody
    public ApiResultModel saveWechatEnclosure(WechatEnclosure wechatEnclosure  ){
             return wechatEnclosureService.addWechatEnclosure(wechatEnclosure);
    }

    /** 编辑WechatEnclosure
     * @param wechatEnclosure  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatEnclosure")
    @ResponseBody
    public ApiResultModel editWechatEnclosure(WechatEnclosure wechatEnclosure  ){
             return wechatEnclosureService.editWechatEnclosure(wechatEnclosure);
    }



    /** 删除一条WechatEnclosure
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatEnclosure")
    @ResponseBody
    public ApiResultModel delWechatEnclosure( Integer id  ){
             return wechatEnclosureService.delWechatEnclosure(id);
    }


}
